package com.arcadia.d2.hero_attributes.attack;

import java.util.Random;

public class Attack {

	private int baseMaxWhite;
	private int baseMinWhite;
	private int green;
	
	public Attack(int green){
		this.baseMinWhite = 0;
		this.baseMaxWhite = 0;
		this.green = green;
	}
	
	public Attack(int baseMinWhite, int baseMaxWhite){
		this.baseMinWhite = baseMinWhite;
		this.baseMaxWhite = baseMaxWhite;
		this.green = 0;
	}
	
	//Accessors
	public int getMaxWhite(int iMainAttribute) {
		return baseMaxWhite + iMainAttribute;
	}

	public int getMinWhite(int iMainAttribute) {
		return baseMinWhite + iMainAttribute;
	}

	public int getGreen() {
		return green;
	}
	
	public int getDifference(){
		return this.baseMaxWhite - this.baseMinWhite;
	}

	//Mutators
	public void setMaxWhite(int maxWhite) {
		this.baseMaxWhite = maxWhite;
	}

	public void setMinWhite(int minWhite) {
		this.baseMinWhite = minWhite;
	}

	public void setGreen(int green) {
		this.green = this.green+green;
	}
	
	public int getAttackDamage(int iMainAttribute){
		Random rndm = new Random();
		if (this.getDifference()>0)
			return this.getMinWhite(iMainAttribute) + this.green + rndm.nextInt(this.getDifference());
		else return this.getMinWhite(iMainAttribute) + this.green;
	}

}
